import {createStore} from 'vuex';

const store = createStore({
    state() {
        return {
            user: null, // 初始化用户状态为空
        };
    },
    mutations: {
        setUser(state, user) {
            state.user = user; // 更新用户信息
        },
    },
    actions: {
        setUser({commit}, user) {
            commit('setUser', user); // 提交用户信息
        },
    },
});

export default store;